@@ -45,13 +45,9 @@ func TestTransactionStore(t *testing.T) {
4545 assert .PanicsWithValue (t , "unexpected type with id gno.vm/t/hello.A" , func () { st .GetType ("gno.vm/t/hello.A" ) })
4646
4747 // Check that hello.A is set in txSt.
48- // Later, we will get hello.A from the parent store; that will do an amino
49- // unmarshal and as such Methods will be unmarshaled to []TypedValue{}.
50- // To make it match in the last assert.Equal, we set it to []TypedValue{} here.
5148 stA := txSt .GetType ("gno.vm/t/hello.A" )
5249 assert .NotNil (t , stA )
5350 assert .Empty (t , stA .(* DeclaredType ).Methods )
54- stA .(* DeclaredType ).Methods = []TypedValue {}
5551
5652 // use write on the stores
5753 txSt .Write ()
@@ -63,7 +59,16 @@ func TestTransactionStore(t *testing.T) {
6359 assert .Equal (t , txSt .GetMemPackage ("gno.vm/t/hello" ), res )
6460 helloA := st .GetType ("gno.vm/t/hello.A" )
6561 assert .NotNil (t , helloA )
66- assert .Equal (t , txSt .GetType ("gno.vm/t/hello.A" ), helloA )
62+ // Normalize nil vs empty slice: amino-unmarshal of an empty repeated field
63+ // returns nil, while the in-memory type retains nil from construction.
64+ // Both represent "no methods" and are semantically equivalent.
65+ if helloA .(* DeclaredType ).Methods == nil {
66+ helloA .(* DeclaredType ).Methods = []TypedValue {}
67+ }
68+ if stA .(* DeclaredType ).Methods == nil {
69+ stA .(* DeclaredType ).Methods = []TypedValue {}
70+ }
71+ assert .Equal (t , stA , helloA )
6772}
6873
6974func TestTransactionStore_blockedMethods (t * testing.T ) {
0 commit comments