Skip to content

[Feature] - Atomic Transaction #1304

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 21 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
6f6bb21
initiate atomic transaction type
astaphobia Oct 19, 2020
f0db84f
pull from experimental and fix conflict files'
astaphobia Oct 19, 2020
b9f8add
restructuring atomic transaction bytes and parser
astaphobia Oct 21, 2020
645eca8
added atomic transaction table and also the schema
astaphobia Oct 21, 2020
c756649
atomic transaction snapshot and rollback:
astaphobia Oct 21, 2020
f3b43c8
update cmd readme and add miss rules on atomic tx
astaphobia Oct 21, 2020
8d82599
ignoring personal goland config
astaphobia Oct 22, 2020
2e4fe61
fix golangci alert
astaphobia Oct 22, 2020
859ae2e
pull experimental and fix conflicts
astaphobia Oct 22, 2020
f7b84e9
fix typo naming
astaphobia Oct 22, 2020
75de896
add some query test case
astaphobia Oct 23, 2020
0746c37
merge from experimental and fix conflict files
astaphobia Oct 23, 2020
72d3af5
atomic transaction apply confirmed test cases
astaphobia Oct 23, 2020
3351d51
fulfill atomic transaction test cases
astaphobia Oct 26, 2020
ef44f70
pull from experimental and fix conflicts:
astaphobia Oct 26, 2020
a6333c5
pull develop and fix some conflict files
astaphobia Nov 23, 2020
f73e6ff
more readable use enum instead static value of child_type
astaphobia Nov 23, 2020
410cb30
Merge branch 'develop' into feature/atomic-tx
astaphobia Nov 24, 2020
fb8cde9
pull develop and fix conflict files
astaphobia Nov 24, 2020
973f5c6
Merge branch 'develop' into feature/atomic-tx
astaphobia Dec 2, 2020
3afea8b
Merge branch 'develop' into feature/atomic-tx
iltoga Jan 6, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ core/service/testdata/snapshots/
_*

*.db-shm
*.db-wal
*.db-wal
.run
2 changes: 1 addition & 1 deletion api/service/transactionApiService.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ func (ts *TransactionService) GetTransactions(
&tx.Signature,
&tx.Version,
&tx.TransactionIndex,
&tx.MultisigChild,
&tx.ChildType,
&tx.Message,
)
if err != nil {
Expand Down
14 changes: 7 additions & 7 deletions api/service/transactionApiService_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ package service
import (
"database/sql"
"errors"
"github.com/zoobc/zoobc-core/common/crypto"
"github.com/zoobc/zoobc-core/common/feedbacksystem"
"github.com/zoobc/zoobc-core/common/storage"
"reflect"
"testing"

"github.com/DATA-DOG/go-sqlmock"
"github.com/sirupsen/logrus"
"github.com/zoobc/zoobc-core/common/chaintype"
"github.com/zoobc/zoobc-core/common/crypto"
"github.com/zoobc/zoobc-core/common/feedbacksystem"
"github.com/zoobc/zoobc-core/common/model"
"github.com/zoobc/zoobc-core/common/query"
"github.com/zoobc/zoobc-core/common/storage"
"github.com/zoobc/zoobc-core/common/transaction"
"github.com/zoobc/zoobc-core/core/service"
"github.com/zoobc/zoobc-core/observer"
Expand Down Expand Up @@ -659,7 +659,7 @@ func (*mockQueryGetTransactionsSuccess) ExecuteSelect(qStr string, tx bool, args
[]byte{0, 0, 0, 0, 0, 0, 0},
1,
1,
false,
model.TransactionChildType_MultiSignatureChild,
[]byte{1, 2, 3},
),
)
Expand Down Expand Up @@ -758,7 +758,7 @@ func TestTransactionService_GetTransactions(t *testing.T) {
Signature: []byte{0, 0, 0, 0, 0, 0, 0},
Version: 1,
TransactionIndex: 1,
MultisigChild: false,
ChildType: model.TransactionChildType_MultiSignatureChild,
Message: []byte{1, 2, 3},
},
},
Expand Down Expand Up @@ -836,7 +836,7 @@ func (*mockQueryGetTransactionSuccess) ExecuteSelectRow(qstr string, tx bool, ar
8,
[]byte{1, 2, 3, 4, 5, 6, 7, 8},
[]byte{0, 0, 0, 0, 0, 0, 0}, 1, 1,
false,
model.TransactionChildType_MultiSignatureChild,
"",
),
)
Expand Down Expand Up @@ -916,7 +916,7 @@ func TestTransactionService_GetTransaction(t *testing.T) {
Signature: []byte{0, 0, 0, 0, 0, 0, 0},
Version: 1,
TransactionIndex: 1,
MultisigChild: false,
ChildType: model.TransactionChildType_MultiSignatureChild,
Message: []byte{},
},
},
Expand Down
26 changes: 13 additions & 13 deletions cmd/account/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ private key both in bytes and hex representation + the secret phrase
Use: "ed25519",
Short: "Generate account using ed25519 algorithm. This is the default zoobc account",
}
bitcoinAccuntCmd = &cobra.Command{
bitcoinAccountCmd = &cobra.Command{
Use: "bitcoin",
Short: "Generate account based on Bitcoin signature that using Elliptic Curve Digital Signature Algorithm",
}
convAccuntToHexCmd = &cobra.Command{
convAccountToHexCmd = &cobra.Command{
Use: "hexconv",
Short: "Convert a given (encoded/string) account address to hex format",
}
Expand Down Expand Up @@ -122,21 +122,21 @@ func init() {
ed25519AccountCmd.Flags().StringVar(&seed, "seed", "", "Seed that is used to generate the account")
ed25519AccountCmd.Flags().BoolVar(&ed25519UseSlip10, "use-slip10", false, "use slip10 to generate ed25519 private key")
// bitcoin
bitcoinAccuntCmd.Flags().StringVar(&seed, "seed", "", "Seed that is used to generate the account")
bitcoinAccuntCmd.Flags().Int32Var(
bitcoinAccountCmd.Flags().StringVar(&seed, "seed", "", "Seed that is used to generate the account")
bitcoinAccountCmd.Flags().Int32Var(
&bitcoinPrivateKeyLength,
"private-key-length",
int32(model.PrivateKeyBytesLength_PrivateKey256Bits),
"The length of private key Bitcoin want to generate. supported format are 32, 48 & 64 length",
)
convAccuntToHexCmd.Flags().StringVar(&encodedAccountAddress, "encodedAccountAddress", "",
convAccountToHexCmd.Flags().StringVar(&encodedAccountAddress, "encodedAccountAddress", "",
"formatted/encoded account address. eg. ZBC_F5YUYDXD_WFDJSAV5_K3Y72RCM_GLQP32XI_QDVXOGGD_J7CGSSSK_5VKR7YML")
convAccuntToHexCmd.Flags().Int32Var(&accountTypeInt, "accountType", 0, "Account type num: 0=default, 1=btc, etc..")
convAccountToHexCmd.Flags().Int32Var(&accountTypeInt, "accountType", 0, "Account type num: 0=default, 1=btc, etc..")
convHexAccountToEncodedCmd.Flags().StringVar(&hexAccountAddress, "hexAccountAddress", "",
"full accound address in hex format: eg. 00000000e1e6ea65267121801089048c3a1dd863aea1fab123977677c612658a749a8a01")
"full account address in hex format: eg. 00000000e1e6ea65267121801089048c3a1dd863aea1fab123977677c612658a749a8a01")
generateAccountAddressTableCmd.Flags().StringVar(&dbPath, "dbPath", "../resource",
"folder path to zoobc.db, relative to cmd root path. if none provided, resource folder will be targeted")
bitcoinAccuntCmd.Flags().Int32Var(
bitcoinAccountCmd.Flags().Int32Var(
&bitcoinPublicKeyFormat,
"public-key-format",
int32(model.BitcoinPublicKeyFormat_PublicKeyFormatCompressed),
Expand All @@ -160,10 +160,10 @@ func Commands() *cobra.Command {
}
ed25519AccountCmd.Run = accountGeneratorInstance.GenerateEd25519Account()
accountCmd.AddCommand(ed25519AccountCmd)
bitcoinAccuntCmd.Run = accountGeneratorInstance.GenerateBitcoinAccount()
accountCmd.AddCommand(bitcoinAccuntCmd)
convAccuntToHexCmd.Run = accountGeneratorInstance.ConvertEncodedAccountAddressToHex()
accountCmd.AddCommand(convAccuntToHexCmd)
bitcoinAccountCmd.Run = accountGeneratorInstance.GenerateBitcoinAccount()
accountCmd.AddCommand(bitcoinAccountCmd)
convAccountToHexCmd.Run = accountGeneratorInstance.ConvertEncodedAccountAddressToHex()
accountCmd.AddCommand(convAccountToHexCmd)
convHexAccountToEncodedCmd.Run = accountGeneratorInstance.ConvertHexAccountToEncoded()
accountCmd.AddCommand(convHexAccountToEncodedCmd)
generateAccountAddressTableCmd.Run = accountGeneratorInstance.GenerateAccountAddressTable()
Expand All @@ -174,7 +174,7 @@ func Commands() *cobra.Command {

}

// GenerateMultiSignatureAccount to generate address for multi signature transaction
// ConvertEncodedAccountAddressToHex to generate address for multi signature transaction
func (gc *GeneratorCommands) ConvertEncodedAccountAddressToHex() RunCommand {
return func(cmd *cobra.Command, args []string) {
var (
Expand Down
Loading