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

[Sign/Web3Wallet] Add pending proposals #744

Closed
wants to merge 1 commit into from

Conversation

alexander-lsvk
Copy link
Contributor

@alexander-lsvk alexander-lsvk commented Mar 13, 2023

Due Dilligence

  • Breaking change
  • Requires a documentation update

guard let proposal = try? record.request.params?.get(SessionType.ProposeParams.self)
else { return nil }

return Session.Proposal(
Copy link
Contributor

Choose a reason for hiding this comment

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

you can use SessionProposal's publicRepresentation(pairingTopic: String) -> Session.Proposal here

Comment on lines +34 to +45
let requestSubscriptionPayloads = pendingHistory
.compactMap { record -> RequestSubscriptionPayload<SessionType.ProposeParams>? in
guard let proposalParams = mapProposeParams(record) else {
return nil
}
return RequestSubscriptionPayload(id: record.id, topic: record.topic, request: proposalParams, publishedAt: Date())
}

requestSubscriptionPayloads.forEach {
let proposal = $0.request
proposalPayloadsStore.set($0, forKey: proposal.proposer.publicKey)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

you do it to set values to proposalPayloadsStore on app launch?

Copy link
Contributor

Choose a reason for hiding this comment

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

make sense

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 when you request for pending proposals

guard let proposalParams = mapProposeParams(record) else {
return nil
}
return RequestSubscriptionPayload(id: record.id, topic: record.topic, request: proposalParams, publishedAt: Date())
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't like we are recreating RequestSubscriptionPayload type here.
could we change type stored by proposalPayloadsStore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Me neither. Your proposal sounds legit 👍

@llbartekll llbartekll self-requested a review March 16, 2023 08:14
Copy link
Contributor

@llbartekll llbartekll left a comment

Choose a reason for hiding this comment

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

in general looks good!

@alexander-lsvk alexander-lsvk changed the title Add pending proposals [Sign/Web3Wallet] Add pending proposals Mar 16, 2023

requestSubscriptionPayloads.forEach {
let proposal = $0.request
proposalPayloadsStore.set($0, forKey: proposal.proposer.publicKey)
Copy link
Contributor

Choose a reason for hiding this comment

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

why we cannot remove proposalPayloadsStore and depend on rpc history only?

If big array of expired proposals the only reason I think it's fine. We can fix it when implement expiration logic for proposals

Copy link
Contributor

Choose a reason for hiding this comment

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

oh yeah, good catch

@llbartekll
Copy link
Contributor

@alexander-lsvk any blockers on this PR?

@llbartekll llbartekll mentioned this pull request May 24, 2023
2 tasks
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.

3 participants