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

Chore/migrate to file data source and fix request requester #29

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

Harman-singh-waraich
Copy link
Contributor

@Harman-singh-waraich Harman-singh-waraich commented May 4, 2024

builds upon #27

closes #28

With this change the request.requester will be set to requestInfo.party.requester , similar for request.challenger.

Rationale

RequestInfo stores the parties [none, requester, challenger] from the msg.sender in the txn.

https://github.com/kleros/tcr/blob/72e547ea135d839dc5db34e79e9f94f05c6a92bb/contracts/LightGeneralizedTCR.sol#L366C2-L368C1

Whereas if we use event.transaction.from in the subgraph, we get tx.origin(which is not always msg.sender) .

request.requester = event.transaction.from;

In case of sponsored txn's (by safe) tx.origin can be a random account and not point to the user's safe address,
whereas msg.sender is the user's safe address.

So using msg.sender as the requestee or challenger makes more sense, as that it the account that interacts at contract level.

⚠️ If a user creates a contract to batch the transactions , or interact with the tcr in general, the msg.sender in this case would be the contract. So it is the user's responsibility to make sure they can withdraw the rewards from that contract, as the rewards will be sent to that contract (requestee at contract level)

@Harman-singh-waraich Harman-singh-waraich changed the title Feat/fix request requester Chore/fix request requester and migrate to file data source May 9, 2024
@Harman-singh-waraich Harman-singh-waraich changed the title Chore/fix request requester and migrate to file data source Chore/migrate to file data source and fix request requester May 9, 2024
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
15.1% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

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.

There is a bug in the code. request.requester = event.transaction.from;
2 participants