-
Notifications
You must be signed in to change notification settings - Fork 52
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
Stateful builder #115
Stateful builder #115
Conversation
@@ -34,6 +34,19 @@ library Suave { | |||
bytes body; | |||
} | |||
|
|||
struct SimulateTransactionResult { | |||
uint64 egp; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So one thing I foresee us needing relatively soon, unless you were to do this with eth_calls, would be the coinbase balance diff before and after simulate transaction for a specific address or array of addresses. I'm not it's worth changing anything about we would handle modifying this struct that we return, but wanted to bring up as a consideration just in case it sparks any ideas.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could see that included as some type of getBalance call to the builder and not enshrined in this struct.
output: | ||
fields: | ||
- name: id | ||
type: string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is id a string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The session id is a uuid
identifier. It gets rendered as a string.
@@ -196,3 +197,20 @@ func (s *suaveRuntime) doHTTPRequest(request types.HttpRequest) ([]byte, error) | |||
} | |||
return data, nil | |||
} | |||
|
|||
func (s *suaveRuntime) newBuilder() (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be interesting to think about two kettles sharing the same session ID and doing a newBuilder(existingSessionID string)
or connectBuilder
. We don't need to consider for this work just mentioning if it inspires anything again!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
permisisons around this has some caution signs for me, you could mess with someones simulation if you knew their session ID if done naively
} | ||
|
||
type Server struct { | ||
sessionMngr sessionManager |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we have a mutex on this? seems possible you could call start a session from another SUAPP before the last new session call has been completed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The locks are on sessionManager
.
context core.ChainContext | ||
} | ||
|
||
func newBuilder(config *builderConfig) *builder { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ruteri curious your thoughts on if this is the best way to set up builder, I remember something non-obvious about reverts changing in builder recently so double check would be appreciated
Number: new(big.Int).Add(parent.Number, common.Big1), | ||
GasLimit: core.CalcGasLimit(parent.GasLimit, s.config.GasCeil), | ||
Time: 1000, // TODO: fix this | ||
Coinbase: common.Address{}, // TODO: fix this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm yeah interesting to think what you would set this to. Two ideas come to mind:
- set to '0x + keccak256("SUAVE")` so its consistent for users
- allow for the ability to set it. I think there may be some scenarios where you if your a builder who also has a contract controlled by your address that does something different based on profit in a block, then you would want to be able to set this. Happy to spell this out more but I think it's desirable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, I think some of these params should be configurable when you start a session like the extra
field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LSTM
📝 Summary
📚 References