-
Notifications
You must be signed in to change notification settings - Fork 31
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
test: enable sim test, race test #326
Changes from 10 commits
00a5627
798eb46
4331513
c6bde73
ffa950d
2b9bee4
793f591
437d1cc
cc190d4
02e37c3
27e4b00
3fab0fb
710c4dd
1a7149d
c9d2940
3509acc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -361,7 +361,7 @@ func (app *BaseApp) setCheckState(header ocproto.Header) { | |
|
||
app.checkState = &state{ | ||
ms: ms, | ||
ctx: ctx.WithConsensusParams(app.GetConsensusParams(ctx)), | ||
ctx: ctx, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This modification reverts a part of #142. |
||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,10 @@ var ( | |
|
||
BaseAccountSig = []byte("bacc") | ||
ModuleAccountSig = []byte("macc") | ||
|
||
PubKeyTypeSecp256k1 = byte(1) | ||
PubKeyTypeEd25519 = byte(2) | ||
PubKeyTypeMultisig = byte(3) | ||
) | ||
|
||
// NewBaseAccount creates a new BaseAccount object | ||
|
@@ -408,9 +412,10 @@ type GenesisAccount interface { | |
// custom json marshaler for BaseAccount & ModuleAccount | ||
|
||
type BaseAccountJSON struct { | ||
Address string `json:"address"` | ||
PubKey json.RawMessage `json:"pub_key"` | ||
Sequence string `json:"sequence"` | ||
Address string `json:"address"` | ||
PubType byte `json:"pub_type"` | ||
PubKey []byte `json:"pub_key"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about grouping the pubkey properties? e.g.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, I apply it. |
||
Sequence string `json:"sequence"` | ||
} | ||
|
||
func (acc BaseAccount) MarshalJSONPB(m *jsonpb.Marshaler) ([]byte, error) { | ||
|
@@ -420,14 +425,17 @@ func (acc BaseAccount) MarshalJSONPB(m *jsonpb.Marshaler) ([]byte, error) { | |
bi.Sequence = strconv.FormatUint(acc.Sequence, 10) | ||
var bz []byte | ||
var err error | ||
if acc.Ed25519PubKey != nil { | ||
bz, err = codec.ProtoMarshalJSON(acc.Ed25519PubKey, m.AnyResolver) | ||
} | ||
if acc.Secp256K1PubKey != nil { | ||
bz, err = codec.ProtoMarshalJSON(acc.Secp256K1PubKey, m.AnyResolver) | ||
bi.PubType = PubKeyTypeSecp256k1 | ||
bz, err = acc.Secp256K1PubKey.Marshal() | ||
} | ||
if acc.Ed25519PubKey != nil { | ||
bi.PubType = PubKeyTypeEd25519 | ||
bz, err = acc.Ed25519PubKey.Marshal() | ||
} | ||
if acc.MultisigPubKey != nil { | ||
bz, err = codec.ProtoMarshalJSON(acc.MultisigPubKey, m.AnyResolver) | ||
bi.PubType = PubKeyTypeMultisig | ||
bz, err = acc.MultisigPubKey.Marshal() | ||
} | ||
if err != nil { | ||
return nil, err | ||
|
@@ -443,42 +451,32 @@ func (acc *BaseAccount) UnmarshalJSONPB(m *jsonpb.Unmarshaler, bz []byte) error | |
if err != nil { | ||
return err | ||
} | ||
/* TODO: do we need to validate address format here | ||
err = sdk.ValidateAccAddress(bi.Address) | ||
if err != nil { | ||
return err | ||
} | ||
*/ | ||
|
||
acc.Address = bi.Address | ||
acc.Sequence, err = strconv.ParseUint(bi.Sequence, 10, 64) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
done := false | ||
if !done { | ||
switch bi.PubType { | ||
case PubKeyTypeSecp256k1: | ||
pk := new(secp256k1.PubKey) | ||
any, _ := codectypes.NewAnyWithValue(pk) | ||
if m.Unmarshal(strings.NewReader(string(bi.PubKey)), any) == nil { | ||
acc.SetPubKey(pk) | ||
done = true | ||
if err := pk.Unmarshal(bi.PubKey); err != nil { | ||
return err | ||
} | ||
} | ||
if !done { | ||
pk := new(ed25519.PubKey) | ||
any, _ := codectypes.NewAnyWithValue(pk) | ||
if m.Unmarshal(strings.NewReader(string(bi.PubKey)), any) == nil { | ||
acc.SetPubKey(pk) | ||
done = true | ||
acc.SetPubKey(pk) | ||
case PubKeyTypeEd25519: | ||
pk := new(secp256k1.PubKey) | ||
if err := pk.Unmarshal(bi.PubKey); err != nil { | ||
return err | ||
} | ||
} | ||
if !done { | ||
acc.SetPubKey(pk) | ||
case PubKeyTypeMultisig: | ||
pk := new(multisig.LegacyAminoPubKey) | ||
any, _ := codectypes.NewAnyWithValue(pk) | ||
if m.Unmarshal(strings.NewReader(string(bi.PubKey)), any) == nil { | ||
acc.SetPubKey(pk) | ||
if err := pk.Unmarshal(bi.PubKey); err != nil { | ||
return err | ||
} | ||
acc.SetPubKey(pk) | ||
} | ||
return nil | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to enable this, research on
test-cosmovisor
is needed. We have to do this as a separate task.