Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion core/services/relay/evm/read/method.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ func (b *MethodBinding) GetLatestValueWithHeadData(ctx context.Context, addr com

callMsg := ethereum.CallMsg{
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we add a test for that? (also with the comment from JIRA why we do that)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added a summary to the PR description.
What would the test look like? We have higher level tests that use method read under the hood.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Judging by the JIRA, it seems essential that the From: is not set. Hence, it seems natural to enforce this behavior in tests (currently, no test would fail if someone introduces From: back)

Copy link
Collaborator Author

@Unheilbar Unheilbar Oct 18, 2025

Choose a reason for hiding this comment

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

method.GetLatestValue is the only place where From can be set; that's where CallMsg is formed. I agree the test case would be reasonable if the scope of setting CallMsg.From were broader.
p.s. Also it's essential for the From not to be a contract address, we don't necessary need to enforce empty From via tests.

Copy link
Collaborator

@pavel-raykov pavel-raykov Oct 18, 2025

Choose a reason for hiding this comment

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

In the tests here

tester := &simpleTester{returnVal: big.NewInt(42), internalType: test}
we essentially construct a chain_reader with a mocked client. Would it be possible to return the mocked client and insert an assertion that CallContract is called with not a contract address?

To: &addr,
From: addr,
Data: data,
}

Expand Down
Loading