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

refactor(*): cleanup #8

Merged
merged 7 commits into from
Jul 29, 2024
Merged

refactor(*): cleanup #8

merged 7 commits into from
Jul 29, 2024

Conversation

ttarsi
Copy link
Contributor

@ttarsi ttarsi commented Jul 28, 2024

  • removes the script/bash directory, in favor of a Makefile
  • fix github actions so they run on PRs
  • remove comments where they are redundant
  • Rename RollupGreeter and GlobalGreeter to Greeter and GreetingBook
  • fix tests
  • remove unnecessary gas limit from GreetingBook
  • fix usage of xmsg.sender
  • update readme
  • other general cleanup and simplifying

Note:

Currently the make deploy command is failing with:

failed to read artifact source file for `{/path/to/dir}/hello-world-template/lib/omni/contracts/src/interfaces/IFeeOracle.sol`

which is strange because building and testing works and DeployGreetingBook has nothing to do with IFeeOracle.

Copy link
Contributor

@kevinhalliday kevinhalliday left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the error you're getting - run forge cache clean and forge clean - I've found forge scripts fail with errors like this when you get rid of old scripts

src/Greeter.sol Outdated Show resolved Hide resolved
src/Greeter.sol Outdated
Comment on lines 23 to 25
bytes memory data = abi.encodeWithSelector(GreetingBook.greet.selector, msg.sender, greeting);

uint256 fee = xcall(omni.omniChainId(), greetingBook, data, DEST_TX_GAS_LIMIT);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we bump sol versions, we can use abi,.encodeCall

test/Greeter.t.sol Outdated Show resolved Hide resolved
Comment on lines 25 to 34
portal.mockXCall(
mockSourceChainId,
address(portal),
address(greetingBook),
abi.encodeWithSelector(GreetingBook.greet.selector, user, greeting),
gasLimit
);
GreetingBook.Greeting memory lastGreet;
(lastGreet.user, lastGreet.message, lastGreet.sourceChainId, lastGreet.timestamp) = greetingBook.lastGreet();
assertEq(lastGreet.message, greeting);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts on portal.mockXCall util?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only thing that's a little confusing is the sender field. We've set it to the portal here, but that doesn't really make sense, in fact is probably an anti-pattern

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the xmsg.sender - so it should never be the portal. We should change that here

@ttarsi ttarsi merged commit 48ff2f5 into main Jul 29, 2024
1 check passed
@ttarsi ttarsi deleted the tt/cleanup branch July 29, 2024 22:23
ttarsi added a commit to omni-network/omni that referenced this pull request Jul 30, 2024
the hello-world-template had a makeover
([here](omni-network/hello-world-template#8))
and references to it need to be updated.

issue: #1596
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants