Skip to content
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

the check for balanceOf(0) does not seem to detect revert #17

Closed
wighawag opened this issue Nov 6, 2019 · 3 comments
Closed

the check for balanceOf(0) does not seem to detect revert #17

wighawag opened this issue Nov 6, 2019 · 3 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@wighawag
Copy link

wighawag commented Nov 6, 2019

I have an ERC721 contract on the mainnet at : 0x266003AfA9976D72565cac0bd840C276b01aE34f

and when I test it against the validator at https://erc721validator.org/?address=0x266003AfA9976D72565cac0bd840C276b01aE34f
It shows that balanceOf(address(0)) does not throw/

But when I execute the eth_call myself to an infura node with

{
	"jsonrpc": "2.0",
	"id": 1,
	"method": "eth_call",
	"params": [{
		"to": "0x266003AfA9976D72565cac0bd840C276b01aE34f",
		"data": "0x70a082310000000000000000000000000000000000000000000000000000000000000000"
	}, "latest"]
}

It gives me

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000156f776e6572206973207a65726f20616464726573730000000000000000000000"
}

which is a revert-reason string so the call indeed revert

In comparison the 0xcert implementation when called with the same request,

{
	"jsonrpc": "2.0",
	"id": 1,
	"method": "eth_call",
	"params": [{
		"to": "0xf176d7bcdD07f8e474877095870685Ef0CCcCb2D",
		"data": "0x70a082310000000000000000000000000000000000000000000000000000000000000000"
	}, "latest"]
}

I get

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x"
}

which is also the response (albeit different) corresponding to a revert/throw

Maybe it is the web3 estimateGas call that does not error out here :
https://github.com/0xcert/erc721-validator/blob/master/src/validator.ts#L47

because it does not consider the error-reason string as an error
See also ethereum/go-ethereum#19027

@wighawag
Copy link
Author

wighawag commented Nov 6, 2019

@fulldecent ^

@MoMannn MoMannn added the bug Something isn't working label Nov 6, 2019
@MoMannn
Copy link
Collaborator

MoMannn commented Nov 6, 2019

@wighawag This indeed seems the reason. We need to change the way we handle reverted calls. We are currently a bit busy with 0xcert framework v2 so it may take a while for us to come to this. For this reason we would appreciate any help on this.

@MoMannn MoMannn added the help wanted Extra attention is needed label Nov 6, 2019
@MoMannn
Copy link
Collaborator

MoMannn commented Nov 14, 2019

#18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants