pond: Integrate StateReply

This commit is contained in:
Łukasz Magiera 2019-09-23 13:15:16 +02:00
parent 9a990dbd8a
commit 18651ecaa3
5 changed files with 54 additions and 6 deletions

View File

@ -193,6 +193,8 @@ type MsgWait struct {
type BlockMessages struct {
BlsMessages []*types.Message
SecpkMessages []*types.SignedMessage
Cids []cid.Cid
}
type SectorInfo struct {

View File

@ -117,6 +117,23 @@ a:hover {
/* POND */
.Pond-connecting {
width: 100vw;
height: 100vh;
background: #1a1a1a;
color: #ffffff;
font-family: monospace;
display: grid;
grid-template-columns: auto min-content auto;
grid-template-rows: auto min-content auto;
grid-template-areas:
". . ."
". main ."
". . ."
}
.App {
min-height: 100vh;
background: #1a1a1a;

View File

@ -17,6 +17,8 @@ class Block extends React.Component {
let messages = await this.props.conn.call('Filecoin.ChainGetBlockMessages', [this.props.cid])
let receipts = await this.props.conn.call('Filecoin.ChainGetBlockReceipts', [this.props.cid])
const mcids = messages.Cids
messages = [
...(messages.BlsMessages.map(m => ({...m, type: 'BLS'}))),
...(messages.SecpkMessages.map(m => ({...(m.Message), type: 'Secpk'})))
@ -24,6 +26,17 @@ class Block extends React.Component {
messages = messages.map((msg, k) => ({...msg, receipt: receipts[k]}))
messages = await Promise.all(messages.map(async (msg, i) => {
if (msg.receipt.ExitCode !== 0) {
let reply = await this.props.conn.call('Filecoin.StateReplay', [{Cids: [this.props.cid], Blocks: [header], Height: header.Height}, mcids[i]])
if(!reply.Error) {
reply.Error = "reply: no error"
}
msg.Error = reply.Error
}
return msg
}))
this.setState({header: header, messages: messages})
}
@ -34,11 +47,14 @@ class Block extends React.Component {
const messages = this.state.messages.map(m => (
<div>
<Address client={this.props.conn} addr={m.From} mountWindow={this.props.mountWindow}/><b>&nbsp;=>&nbsp;</b>
<Address client={this.props.conn} addr={m.To} mountWindow={this.props.mountWindow} transfer={m.Value} method={m.Method}/>
<span>&nbsp;N{m.Nonce}</span>
<span>&nbsp;{m.receipt.GasUsed}Gas</span>
{m.receipt.ExitCode !== 0 ? <span>&nbsp;<b>EXIT:{m.receipt.ExitCode}</b></span> : <span/>}
<div>
<Address client={this.props.conn} addr={m.From} mountWindow={this.props.mountWindow}/><b>&nbsp;=>&nbsp;</b>
<Address client={this.props.conn} addr={m.To} mountWindow={this.props.mountWindow} transfer={m.Value} method={m.Method}/>
<span>&nbsp;N{m.Nonce}</span>
<span>&nbsp;{m.receipt.GasUsed}Gas</span>
{m.receipt.ExitCode !== 0 ? <span>&nbsp;<b>EXIT:{m.receipt.ExitCode}</b></span> : <span/>}
</div>
{m.receipt.ExitCode !== 0 ? <div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Error: <b>{m.Error}</b></div> : <span/>}
</div>
))

View File

@ -35,9 +35,11 @@ class Pond extends React.Component {
render() {
if (this.state.client === undefined) {
return (
<div className="Pond-connecting">
<div>
Connecting to RPC
<div>Connecting to Pond RPC</div>
</div>
</div>
)
}

View File

@ -77,9 +77,20 @@ func (a *ChainAPI) ChainGetBlockMessages(ctx context.Context, msg cid.Cid) (*api
return nil, err
}
cids := make([]cid.Cid, len(bmsgs)+len(smsgs))
for i, m := range bmsgs {
cids[i] = m.Cid()
}
for i, m := range smsgs {
cids[i+len(bmsgs)] = m.Cid()
}
return &api.BlockMessages{
BlsMessages: bmsgs,
SecpkMessages: smsgs,
Cids: cids,
}, nil
}