-
Notifications
You must be signed in to change notification settings - Fork 65
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
Bridge contracts: implement require(cond, error) pattern and update to solc 0.8.27 #852
base: main
Are you sure you want to change the base?
Conversation
…ate to solc 0.8.27
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.
The scope of the issue is to fix input validation, and use the requires
pattern for input validation.
Some of the proposed changes impact code that is not input validation and should not be changed to use requires
.
protocol-units/bridge/contracts/src/AtomicBridgeInitiatorMOVE.sol
Outdated
Show resolved
Hide resolved
Thank you @franck44, I made the requested changes. |
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.
Thanks @andygolay !
@franck44 I believe that if it's not a conditional logic flow, require should be used for consistency. |
Whatever you guys decide is okay with me; I did look it up and it seems like require is technically fine to use throughout, but it's conventionally used for input values. I wonder if that's because require used to be less gas efficient, so it was used sparingly? And maybe now conventions can shift to using require in general? It does strike me as more normalized syntax to use require for all checks that could revert with a custom error. The first commit is with all require, the second is with require on input values only. I'll defer to the team as I don't have a strong opinion about it. |
@0xPrimata
No, that's not best practice. I provided lots of documentation in issue 827, so we are going to follow best practice.
We can merge this PR and close the issue. |
I forgot to mention that there is another reason why |
Summary
require
for input validation rather thanif-revert
pattern #827bridge
,contracts
Changelog
Update
AtomicBridgeInitiatorMOVE.sol
and AtomicBridgeCounterparty.sol` to use the require -> custom error pattern.Testing
Solidity tests pass with
forge test --fork-url https://ethereum-sepolia-rpc.publicnode.com -vv
inprotocol-units/bridge/contracts
Outstanding issues