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

Feature/tx fees #101

Merged
merged 15 commits into from
Mar 29, 2024
Merged

Feature/tx fees #101

merged 15 commits into from
Mar 29, 2024

Conversation

maht0rz
Copy link
Member

@maht0rz maht0rz commented Jan 22, 2024

No description provided.

)
);

const root = this.feeTree.tree.getRoot();
Copy link
Member

Choose a reason for hiding this comment

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

I don't this it is a good idea to inline this logic that way for multiple reasons. It gets really hard to reason about what parts of that tree make it into the circuit and which don't. So I would like to see this logic (i.e. the tree + witness generation) in a decoupled unit. What I would do is to create a @singleton service consuming the runtime, building the tree and creating a getRoot() and getWitness() method. Also, I'd use bigint for getRoot() to make sure that there is no coupling and it is a constant

)
);

const balances =
Copy link
Member

Choose a reason for hiding this comment

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

Let's do that in the constructor. No particular reason but I get scared when I see circuit and non-circuit code mixed like this.


public setBalance(tokenId: TokenId, address: PublicKey, amount: Balance) {
const key = new BalancesKey({ tokenId, address });
this.events.emit("setBalance", key, amount);
Copy link
Member

Choose a reason for hiding this comment

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

I am not really happy with that, since that requires a extra PR to work properly (would currently fire multiple times for different values without a way to really use them properly)

// Has to be super.config, getters behave really weird when subtyping
const config = super.config?.[moduleName];

const config = this.config?.[moduleName];
Copy link
Member

Choose a reason for hiding this comment

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

This breaks the configuration functionality. Execute ContainerEvents.test.ts and see for yourself

@maht0rz maht0rz merged commit 068457a into develop Mar 29, 2024
2 of 4 checks passed
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