Skip to content

Conversation

@0xMimir
Copy link
Contributor

@0xMimir 0xMimir commented Oct 15, 2024

Update reducer to accept action instead of reference to action, this is to make p2p layer ready for full stateful vs effetcful split between actions.

The cloning of an action shouldn't impact the stack size, since the size of P2pAction is only 184 bytes. In most cases, it needs to be either fully or partially cloned to update the state and/or pass data to new actions.

@0xMimir 0xMimir force-pushed the feat/update-reducer branch from 2af9111 to 63be363 Compare October 15, 2024 14:03
@0xMimir 0xMimir requested review from dkuehr and tizoc October 15, 2024 14:35
Copy link
Contributor

@dkuehr dkuehr left a comment

Choose a reason for hiding this comment

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

Could you add a description of why this change is needed?
Have you measured this change has a big impact in the amount of stack used?

let result = p2p::P2pState::reducer(
Substate::new(state, dispatcher),
meta.with_action(action),
meta.with_action(action.clone()),
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am thinking that In general, for the remaining of the code, being that we still need to clone the action I would wait until much later to take care of these kind of changes, because I don't think they offer any immediate benefit.

Copy link
Collaborator

@tizoc tizoc left a comment

Choose a reason for hiding this comment

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

Left a few comments, but LGTM in general. Having said that, I would leave these kind of refactors for later, when we can get an actual benefit from the change, I don't think we get a noticeable improvement from these changes right now (but I may be missing something).

@tizoc
Copy link
Collaborator

tizoc commented Oct 15, 2024

I am even worried that it may introduce many conflicts to #794, so I would wait for that one first before merging this PR @0xMimir to avoid slowing it down.

@0xMimir 0xMimir force-pushed the feat/update-reducer branch from c9db83c to 53cb88e Compare October 16, 2024 09:19
@0xMimir 0xMimir force-pushed the feat/update-reducer branch from 53cb88e to 74ce6c9 Compare October 16, 2024 09:30
@tizoc
Copy link
Collaborator

tizoc commented Oct 16, 2024

@0xMimir out of curiosity, how complicated was the rebase after #794 got merged?

@0xMimir 0xMimir merged commit 1befb61 into o1-labs:develop Oct 16, 2024
27 checks passed
@0xMimir 0xMimir deleted the feat/update-reducer branch October 30, 2024 14:36
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