Skip to content

Commit

Permalink
Revert "[iip15] fix caused an error within EVM when the contract was …
Browse files Browse the repository at this point in the history
…not registered (#3929)"

This reverts commit 8eb196d.
  • Loading branch information
dustinxie committed Aug 12, 2024
1 parent d3ab35a commit bc2fdcb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 0 additions & 4 deletions blockindex/sgd_indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,10 +444,6 @@ func (sgd *sgdRegistry) CheckContract(ctx context.Context, contract string, heig
}
sgdIndex, err := sgd.getSGDIndex(addr.Bytes())
if err != nil {
// if the contract is not registered, return nil to prevent the evm from throwing error
if errors.Cause(err) == db.ErrNotExist || errors.Cause(err) == db.ErrBucketNotExist {
return nil, 0, false, nil
}
return nil, 0, false, err
}

Expand Down
2 changes: 1 addition & 1 deletion blockindex/sgd_indexer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func TestNewSGDRegistry(t *testing.T) {
blk := createTestingBlock(builder, 4, h, exec, logs)
r.NoError(sgdRegistry.PutBlock(ctx, blk))
receiver, percentage, isApproved, err := sgdRegistry.CheckContract(ctx, registerAddress.String(), 4)
r.NoError(err)
r.ErrorContains(err, "not exist in DB")
r.Nil(receiver)
r.False(isApproved)
hh, err := sgdRegistry.Height()
Expand Down
3 changes: 3 additions & 0 deletions e2etest/sgd_registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ func TestSGDRegistry(t *testing.T) {
"c375c2ef0000000000000000000000005b38da6a701c568545dcfcb03fcb875f56beddc4",
},
checkContractExpect: checkContractExpectation{
errorContains: "not exist in DB",
contractAddress: registerAddress.String(),
},
},
Expand All @@ -189,6 +190,7 @@ func TestSGDRegistry(t *testing.T) {
"07f7aafb0000000000000000000000005b38da6a701c568545dcfcb03fcb875f56beddc4",
},
checkContractExpect: checkContractExpectation{
errorContains: "not exist in DB",
contractAddress: registerAddress.String(),
},
},
Expand Down Expand Up @@ -226,6 +228,7 @@ func TestSGDRegistry(t *testing.T) {
"07f7aafb0000000000000000000000005b38da6a701c568545dcfcb03fcb875f56beddc4",
},
checkContractExpect: checkContractExpectation{
errorContains: "not exist in DB",
contractAddress: registerAddress.String(),
},
},
Expand Down

0 comments on commit bc2fdcb

Please sign in to comment.