-
Notifications
You must be signed in to change notification settings - Fork 228
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
[entropy] Add a default provider #1150
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Ignored Deployments
|
@@ -64,7 +65,9 @@ contract EntropyTest is Test { | |||
uint64 startSequenceNumber, | |||
uint64 size | |||
) public pure returns (bytes32[] memory hashChain) { | |||
bytes32 initialValue = keccak256(abi.encodePacked(startSequenceNumber)); | |||
bytes32 initialValue = keccak256( | |||
abi.encodePacked(provider, startSequenceNumber) |
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.
this was a bug in previous versions where the hash chains for both providers were exactly the same. turns out i wasn't using provider2's hash chain in any of the other tests though.
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.
While in solidity it is allowed to have multiple functions with same name and different signatures I have found that the explorers (etherscan) and client libraries (ethers, web3) are not good at handling them. For example they struggle to understand which request does contract.methods.request
refers to and you need to use something like contract.methods["request(bytes32,bool)"].call...
. So I recommend using different function names for the default ones.
Update to this PR here. I decided it doesn't make sense to create other versions of request/reveal/getFee if they can't share the same name. Instead, people can just call I also added a |
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.
Nice!
@@ -68,6 +80,7 @@ contract EntropyTest is Test { | |||
} | |||
|
|||
// Test helper method for requesting a random value as user from provider. | |||
// If provider is all-zeros, use the default provider in the contract. |
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.
Are you actually using it? I'm not seeing this be implemented too :?
The current interface forces users to pick a provider. This is awkward when there's really only one provider initially. This PR lets governance choose a default and adds some convenience methods for invoking the request/reveal flow with the default. This should simplify things for most users.