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

Pass a context (environment?) object to IAction.Execute() method #49

Closed
dahlia opened this issue Jan 23, 2019 · 1 comment
Closed

Pass a context (environment?) object to IAction.Execute() method #49

dahlia opened this issue Jan 23, 2019 · 1 comment
Labels
suggestion Suggestion or feature request
Milestone

Comments

@dahlia
Copy link
Contributor

dahlia commented Jan 23, 2019

Some operations such as random generation can depend on information determined by a mined block, that a transaction belongs to. However, since simply passing a Block object to IAction.Execute() may accidentally cause unpredictable dependencies in the future, the information should be limited to only what we actually need at present.

A type for a such information unit can be named Context or Environment, I think? @kijun @longfin Any suggestions are welcome.

IAction.Execute(Address, AddressStateMap)'s signature also should be changed like:

AddressStateMap Execute(Address from, Address to, AddressStateMap states, IContext ctx);

The IContext interface would look like at first:

public interface IContext {
    System.Random Random { get; }
}
@dahlia dahlia added the suggestion Suggestion or feature request label Jan 23, 2019
@dahlia dahlia added this to the 0.1.0 milestone Jan 23, 2019
@dahlia
Copy link
Contributor Author

dahlia commented Feb 7, 2019

#55 implemented this. Thanks for @hanc1208.

@dahlia dahlia closed this as completed Feb 7, 2019
dahlia pushed a commit to dahlia/libplanet that referenced this issue Mar 9, 2021
limebell pushed a commit to limebell/libplanet that referenced this issue Jul 7, 2021
…ement

Fix item enhancement with cost not work
OnedgeLee pushed a commit to OnedgeLee/libplanet that referenced this issue Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
suggestion Suggestion or feature request
Projects
None yet
Development

No branches or pull requests

1 participant