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

Dev 4.x #59

Open
wants to merge 110 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
a513bd3
adding the new syshub to a new branch within the initial repository, …
bandicootdev Dec 19, 2020
c04f088
adding the new syshub to a new branch within the initial repository, …
bandicootdev Dec 19, 2020
dcc9863
adding content to the .env_example
bandicootdev Dec 21, 2020
e7d3fc7
firebase config file missing
bandicootdev Dec 21, 2020
01e46c3
changes to responses from the nextGovernanceRewardInfo endpoint
bandicootdev Dec 28, 2020
ab930fa
added admin pages and routing, added admin role on the user context
amirbv Dec 28, 2020
4f6ca9b
added style to the users table in admin
amirbv Dec 29, 2020
3f014b3
users table
amirbv Dec 29, 2020
2454359
modifying the table
amirbv Dec 30, 2020
605ada1
added pagination to the users table
amirbv Dec 30, 2020
9538334
add functionality to search user and add proposals table with fake data
amirbv Jan 7, 2021
e166708
changes to the admin tables
amirbv Jan 11, 2021
b91c747
add functionality to remove and add admin
amirbv Jan 11, 2021
1efe07f
add sweet alerts to the users functionality
amirbv Jan 12, 2021
0c5f560
add new file of voting address in profile
amirbv Jan 12, 2021
e50c511
changed masternodes to voting address
amirbv Jan 13, 2021
1bbb17d
changes in meta description and useffect test in context
bandicootdev Jan 13, 2021
0247d01
Merge branch 'dev-4.x' of https://github.com/syscoin/syshub into dev-4.x
bandicootdev Jan 13, 2021
02c6524
changes in command vote
bandicootdev Jan 13, 2021
e02ff46
add voting address updated
amirbv Jan 13, 2021
fea7c19
remove console log
amirbv Jan 13, 2021
4c14f14
modify masternodes list on governance to addresses list
amirbv Jan 13, 2021
0c960a1
change addresslist
amirbv Jan 13, 2021
bae38ab
update to the 2fa inputs and admin panel
amirbv Jan 14, 2021
05e2c97
added the new doc of admin section
amirbv Jan 14, 2021
6b34999
updated the documentation files on the /docs folder
amirbv Jan 14, 2021
c1b602d
disable validation of sys address
amirbv Jan 14, 2021
0f95318
added default values to payment form
amirbv Jan 15, 2021
9068641
add environment variable, changes in network variable for test
bandicootdev Jan 15, 2021
43f4256
Merge branch 'dev-4.x' of https://github.com/syscoin/syshub into dev-4.x
bandicootdev Jan 15, 2021
6010ae1
fix refreshToken in request
bandicootdev Jan 17, 2021
3994fd5
Fixed worldMap updating problem, added new paragraph if tere are no p…
amirbv Jan 18, 2021
9728bfa
changes for the calculation of payments
bandicootdev Jan 18, 2021
d42eeea
changes to firebase.js
amirbv Jan 18, 2021
377696f
changes names in request
bandicootdev Jan 18, 2021
9cb1c7f
Merge branch 'dev-4.x' of https://github.com/syscoin/syshub into dev-4.x
bandicootdev Jan 18, 2021
65070ee
history on multiple add
amirbv Jan 19, 2021
c897140
comment console.logs
amirbv Jan 19, 2021
be10c20
added the iconinfo component for the inputs info
amirbv Jan 20, 2021
948fb24
added timer to the add sms 2fa form
amirbv Jan 21, 2021
fd92967
changes to the information path and change of endpoints
bandicootdev Jan 21, 2021
1c8e9ee
changes to obtain the information of the masternodes through the sysh…
bandicootdev Jan 22, 2021
e4f6f40
add many addresses
amirbv Jan 22, 2021
42e02e4
added f.a.q. page and added it in the withTranslation index
amirbv Jan 22, 2021
1437318
added icon to the add and edit voting address inputs and their descri…
amirbv Jan 25, 2021
4028e9e
added faq table and add/update faq route
amirbv Jan 26, 2021
aafd4f7
add commented styles on faqform
amirbv Jan 26, 2021
66367fd
add functionalities to the editor
bandicootdev Jan 26, 2021
99f2b3f
resolver fusión
bandicootdev Jan 26, 2021
0eea5b0
send email verification
bandicootdev Jan 26, 2021
38a32bf
add public faq list and faq item
amirbv Jan 27, 2021
852ff73
history push after adding single voting address
amirbv Jan 27, 2021
d5edf6e
change messages errors in add voting address
bandicootdev Jan 27, 2021
e9e48b2
visual fixes
amirbv Jan 27, 2021
ba96ded
added new documentation to the faq and admin components
amirbv Jan 28, 2021
81bb8fb
validation of proposals in governance
bandicootdev Jan 28, 2021
32362cd
Merge branch 'dev-4.x' of https://github.com/syscoin/syshub into dev-4.x
bandicootdev Jan 28, 2021
f4c3db6
delete logs
bandicootdev Jan 28, 2021
5534558
sanitize the dangerous html
amirbv Jan 29, 2021
6a6c9d5
add copy to clipboard in proposal hash, commented 2fa in deleting vot…
amirbv Feb 1, 2021
2a1c3d1
change fixs links social in footer
bandicootdev Feb 2, 2021
618aab1
change old sysnodeinfo path to syshub-api path for rsb calculation
bandicootdev Feb 5, 2021
52fd237
added info to the add voting address
amirbv Feb 5, 2021
521bbe9
Merge branch 'dev-4.x' of https://github.com/syscoin/syshub into dev-4.x
amirbv Feb 5, 2021
6dc5fc3
remove console.log in faqitem
amirbv Feb 5, 2021
bf6650f
swal changes when adding voting addresses
bandicootdev Feb 6, 2021
0cc5780
added swal to sms 2fa form
amirbv Feb 10, 2021
399cd32
fix state on proposalForm
amirbv Feb 12, 2021
88f26eb
update schema add address form
amirbv Feb 12, 2021
ac00f3c
vulnerability bug fix
bandicootdev Feb 13, 2021
e2d52be
Merge remote-tracking branch 'origin/dev-4.x' into dev-4.x
bandicootdev Feb 13, 2021
c2d03b6
update routes
amirbv Feb 15, 2021
8265698
fix on conditional for token authentication
bandicootdev Feb 15, 2021
289fca8
Merge branch 'dev-4.x' of https://github.com/syscoin/syshub into dev-4.x
bandicootdev Feb 15, 2021
1e8bd0f
fix view html in FaqItem component
bandicootdev Feb 16, 2021
72315db
update changes on the router
amirbv Feb 16, 2021
95a7314
Merge branch 'dev-4.x' of https://github.com/syscoin/syshub into dev-4.x
amirbv Feb 16, 2021
bbcbbc6
fix router path
amirbv Feb 16, 2021
c553bf2
fix nan and infinity in calculations when mn does not exist
bandicootdev Feb 16, 2021
a259154
fix nan and infinity in calculations when mn does not exist
bandicootdev Feb 16, 2021
9b7f227
fix swal on admin
amirbv Feb 18, 2021
b0de023
fix signup form when is invalid
amirbv Feb 18, 2021
efde820
added new route and section for masternode registration
amirbv Feb 18, 2021
e05cdeb
create commands masternode register.
bandicootdev Feb 19, 2021
9cf4a81
part of the masternode registration form
amirbv Feb 19, 2021
1f7bba4
masternodes registration form finished
amirbv Feb 19, 2021
76230f2
offline user verification
bandicootdev Feb 20, 2021
36b3efc
information changes for a masternode registration
bandicootdev Feb 22, 2021
cc72d89
fix p in masternode form
amirbv Feb 22, 2021
aea464f
data error at the time of a pwd change
bandicootdev Mar 1, 2021
df3da85
fix vulnerabilities
bandicootdev Mar 4, 2021
051d3ce
fix logo relative routes to absolute routes
amirbv Mar 8, 2021
d9ac96c
remove whitespaces on docs files and eslintcache from repo
amirbv Apr 9, 2021
51ebb27
delete file firebase-debug.log
bandicootdev Apr 11, 2021
6b1aa77
change ip:port to mainnet in masternode registration
bandicootdev Apr 30, 2021
6f37865
fix buttons on homepage
amirbv Apr 30, 2021
57ed9b1
change signmessage command
bandicootdev May 3, 2021
087bd37
removed forkawesome from the public files and added the CDN link
amirbv May 3, 2021
3a20879
added the current date to the project
amirbv May 5, 2021
1fe7017
refactor conditional in generateSignCommand function
bandicootdev May 13, 2021
97de577
resolve fix decrypt in voting sign
bandicootdev Oct 28, 2021
86314e7
change fix for update 2FA
bandicootdev Nov 4, 2021
891b7ac
resolve fix for get info 2FA
bandicootdev Nov 4, 2021
7a5ab71
resolve fix for validation address
bandicootdev Nov 5, 2021
96d8858
resolve fix domPurify
bandicootdev Nov 6, 2021
da4dbb7
resolve fix logout user
bandicootdev Nov 10, 2021
fe8b7a9
resolve fix unnecessary requets with api
bandicootdev Nov 25, 2021
93dc68c
resolve fix input type password in gAuthForm
bandicootdev Nov 27, 2021
1224f3e
new resolve fixs for 2fa authenticator required necessary code
bandicootdev Jan 1, 2022
808b337
fix unescape html
bandicootdev Jan 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/components/governance/AddressList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import AddressItem from "./AddressItem";

import CustomModal from "../global/CustomModal";
import Modal2FA from "../profile/2FA/Modal2FA";
import {decryptVotingKey} from "../../utils/encryption";

/**
* Component to show the voting address list of the user
Expand Down Expand Up @@ -152,13 +153,13 @@ const AddressList = ({proposal, vote, onAfterVote}) => {
let addressVoted = []
let addressErrorVote = []
for await (const address of addressToVote) {
const addrDecrypt=decryptVotingKey({privateKey:address.privateKey, txId:address.txId})
const proposalVoteNo = {
mnPrivateKey: address.privateKey,
vinMasternode: address.txId,
mnPrivateKey: addrDecrypt.privateKey,
vinMasternode: addrDecrypt.txId,
gObjectHash: proposal.Hash,
voteOutcome: vote,
};

const voteData = signVote(proposalVoteNo)
await voteProposal(voteData)
.then(async data => {
Expand All @@ -177,6 +178,7 @@ const AddressList = ({proposal, vote, onAfterVote}) => {
// })
})
.catch(err => {
console.log(err)
addressErrorVote.push({
name: address.name,
err: (voteData === 'Invalid network version') ? 'Invalid network version' : err.response.data.message
Expand Down
13 changes: 2 additions & 11 deletions src/utils/sign-vote.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import {crypto, ECPair,networks} from 'bitcoinjs-lib'
import {crypto, ECPair,networks,address} from 'bitcoinjs-lib'
import {Buffer} from 'buffer'
import {Int64LE} from 'int64-buffer'
import secp256k1 from 'secp256k1'
import {swapEndiannessInPlace, swapEndianness} from 'buffer-math'

/**
* This function returns an object that the api must receive to make the vote through the mn, collecting the data for the vote and making the signature
* @function
Expand All @@ -14,7 +13,7 @@ const signVote = (obj) => {
// eslint-disable-next-line
try {
const {mnPrivateKey, vinMasternode, gObjectHash, voteOutcome} = obj
const network= process.env.REACT_APP_CHAIN_NETWORK !== 'main'?networks.testnet:networks.bitcoin;
const network= process.env.REACT_APP_CHAIN_NETWORK !== 'main'? networks.testnet:networks.bitcoin;
sidhujag marked this conversation as resolved.
Show resolved Hide resolved
const time = Math.floor(Date.now() / 1000);
const gObjectHashBuffer = Buffer.from(gObjectHash, 'hex');
const voteSignalNum = 1; // 'funding'
Expand All @@ -24,19 +23,14 @@ const signVote = (obj) => {

const vinMasternodeBuffer = Buffer.from(masterNodeTx[0], 'hex');
swapEndiannessInPlace(vinMasternodeBuffer);

const vinMasternodeIndexBuffer = Buffer.allocUnsafe(4);
const outputIndex = parseInt(masterNodeTx[1]);
vinMasternodeIndexBuffer.writeInt32LE(outputIndex);

const gObjectHashBufferLE = swapEndianness(gObjectHashBuffer);

const voteOutcomeBuffer = Buffer.allocUnsafe(4);
voteOutcomeBuffer.writeInt32LE(voteOutcomeNum);

const voteSignalBuffer = Buffer.allocUnsafe(4);
voteSignalBuffer.writeInt32LE(voteSignalNum);

const timeBuffer = new Int64LE(time).toBuffer();
const message = Buffer.concat([
vinMasternodeBuffer,
Expand All @@ -50,9 +44,7 @@ const signVote = (obj) => {
const hash = crypto.hash256(message);
const keyPair = ECPair.fromWIF(`${mnPrivateKey}`,network)
const sigObj = secp256k1.sign(hash, keyPair.privateKey);

const recId = 27 + sigObj.recovery + (keyPair.compressed ? 4 : 0);

const recIdBuffer = Buffer.allocUnsafe(1);
recIdBuffer.writeInt8(recId);
const rawSignature = Buffer.concat([recIdBuffer, sigObj.signature]);
Expand All @@ -72,7 +64,6 @@ const signVote = (obj) => {
if (voteOutcomeNum === 1) vote = 'yes';
if (voteOutcomeNum === 2) vote = 'no';
if (voteOutcomeNum === 3) vote = 'abstain';

return {
txHash: masterNodeTx[0],
txIndex: masterNodeTx[1],
Expand Down